﻿using ConfExpert.Forms.Base;
using DevTeam;

using System;
using System.Windows.Forms;

namespace ConfExpert.Forms.Siparisler
{
    public partial class MaliyetRvs : XForm
    {
        int MaliyetId;
        public int Revision;
        public string Notes;
        public MaliyetRvs(int _MaliyetId)
        {
            InitializeComponent();
            MaliyetId = _MaliyetId;
            TAM.MaliyetRvsTableAdapter = new Datasets.MyDataTableAdapters.MaliyetRvsTableAdapter();
        }

        BindingSource bs;
        private void MaliyetRvs_Load(object sender, EventArgs e)
        {
            bs = new BindingSource(ds, "MaliyetRvs");
            AddBsToList(bs);
            InitGridView(gv1, bs);
            GetDetails("MaliyetRvs", "GetMaliyetRvs", MaliyetId);
            gv1.OptionsBehavior.Editable = false;
            gv1.Columns["MaliyetId"].Visible = gv1.Columns["MaliyetRvsId"].Visible = false;
            gv1.Columns["Notes"].ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
            gv1.BestFitColumns();

            btnOK.ItemClick += BtnOK_ItemClick;
            gv1.SetViewCaption("Revision History");
        }

        private void BtnOK_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Revision = (int)ExecuteScalar("UpdMaliyetRvs", MaliyetId, memoEdit1.EditValue.ToStr(), WhoAmI);
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}